//---------------------------------------------------------------------------

#ifndef main_GhostH
#define main_GhostH

#define Unit1.cpp_CSDEBUG

//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Grids.hpp>
#include <Math.hpp>
#include <stdio.h>
#include "DebugForm.h"
#include <DB.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <ADODB.hpp>
#include <DBGrids.hpp>
#include <Buttons.hpp>
#include <ImgList.hpp>
#include <ToolWin.hpp>
#include "DBGridEh.hpp"
#include "DBGridEhGrouping.hpp"
#include "DBGridEhImpExp.hpp"
#include "GridsEh.hpp"
#include <Db.hpp>
#include <Dialogs.hpp>
#include "CodeSiteLogging.hpp"
#include <DBCtrls.hpp>
#include <Menus.hpp>
#include "PrnDbgeh.hpp"
#include "PrViewEh.hpp"
#include "DBSumLst.hpp"
#include "trayicon.h"
#include "AdvGrid.hpp"
#include "BaseGrid.hpp"
//---------------------------------------------------------------------------
class TfrmMainGhost : public TForm
{
__published:	// IDE-managed Components
        TDataSource *DataSource1;
        TADOTable *ADOTable1;
        TADOQuery *ADOQuery1;
        TPanel *pnlCtrl;
        TPanel *pnlPage;
        TPageControl *pgcMain;
        TTabSheet *tsMain;
        TStringGrid *strGdCode;
        TPanel *pnlPg1;
        TButton *btnFindCode;
        TEdit *edtCode;
        TTabSheet *tsSet;
        TTabSheet *tsHelp;
        TTabSheet *tsCache;
        TLabel *Label4;
        TLabel *Label3;
        TButton *Button4;
        TButton *Button5;
        TButton *Button2;
        TEdit *Edit1;
        TUpDown *UpDown1;
        TMemo *mmoCatchedt;
        TComboBox *cbbFinalProduct;
        TComboBox *cbbSet;
        TButton *btnFind;
        TBitBtn *BitBtn1;
        TADOQuery *ADOQuery2;
        TADOTable *ADOTable2;
        TImageList *ImageList1;
        TADOConnection *ADOConnection1;
        TADOCommand *ADOCommand1;
        TDataSource *DataSource2;
        TMemo *mmo1;
        TMemo *mmo2;
        TStringGrid *StringGrid1;
        TButton *Button1;
        TButton *Button3;
        TButton *Button6;
        TSaveDialog *SaveDialog1;
        TADOQuery *ADOQuery3;
        TButton *Button7;
        TMemo *mmo3;
        TLabel *Label1;
        TMemo *mmo4;
        TDataSource *DataSource3;
        TCSGlobalObject *CSGlobalObject1;
        TTimer *tmr1;
        TMemo *mmo5;
        TProgressBar *pb1;
        TADOQuery *ADOQuery4;
        TDataSource *DataSource4;
        TMemo *mmo6;
        TButton *btnConnectServer;
        TComboBox *cbb1;
        TTabSheet *ts1;
        TMainMenu *mm1;
        TMenuItem *mniN1;
        TMenuItem *mniN2;
        TMenuItem *mniN3;
        TMenuItem *mniN4;
        TMenuItem *mniN5;
        TMenuItem *mniN6;
        TMenuItem *mniN7;
        TMenuItem *mniExcel1;
        TComboBox *cbb2;
        TPrintDBGridEh *prntdbgrdh1;
        TButton *Button9;
        TDBSumList *DBSumList1;
        TMenuItem *mniN8;
        TPanel *pnl1;
        TButton *Button10;
        TSaveDialog *dlgSave1;
        TTabSheet *ts2;
        TStringGrid *StringGrid2;
        TSplitter *spl1;
        TButton *Button11;
        TADOQuery *ADOQuery5;
        TButton *Button12;
        TTabSheet *ts3;
        TStringGrid *StringGrid3;
        TButton *Button13;
        TTabSheet *ts4;
        TAdvStringGrid *AdvStringGrid1;
        TButton *Button14;
        TButton *Button15;
        TMenuItem *mniN11;
        TStringGrid *dbgrdh1;
        TStringGrid *dbgrdh2;
        TComboBox *cbbDataBase;
        TLabel *lblDataBase;
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall Button5Click(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall Button3Click(TObject *Sender);
    //    void __fastcall DBGrid1MouseMove(TObject *Sender,
    //      TShiftState Shift, int X, int Y);
    //   void __fastcall DBGrid1ColumnMoved(TObject *Sender, int FromIndex,
    //     int ToIndex);
        void __fastcall Button4Click(TObject *Sender);
//        void __fastcall strGdCodeDrawCell(TObject *Sender, int ACol,
//          int ARow, TRect &Rect, TGridDrawState State);
//        void __fastcall StringGrid1DrawCell(TObject *Sender, int ACol,
//         int ARow, TRect &Rect, TGridDrawState State);
        void __fastcall btnFindCodeClick(TObject *Sender);
        void __fastcall edtCodeChange(TObject *Sender);
        void __fastcall strGdCodeDblClick(TObject *Sender);
        void __fastcall btnFindClick(TObject *Sender);
        void __fastcall BitBtn1Click(TObject *Sender);
        void __fastcall Button6Click(TObject *Sender);
        void __fastcall Button7Click(TObject *Sender);
        void __fastcall FormShow(TObject *Sender);
        void __fastcall ADOQuery1FetchProgress(TCustomADODataSet *DataSet,
          int Progress, int MaxProgress, TEventStatus &EventStatus);
        void __fastcall ADOQuery3FetchProgress(TCustomADODataSet *DataSet,
          int Progress, int MaxProgress, TEventStatus &EventStatus);
        void __fastcall tmr1Timer(TObject *Sender);
        void __fastcall btnConnectServerClick(TObject *Sender);
        void __fastcall mniN5Click(TObject *Sender);
        void __fastcall mniN6Click(TObject *Sender);
        void __fastcall mniExcel1Click(TObject *Sender);
        void __fastcall mniN7Click(TObject *Sender);
        void __fastcall ADOQuery4FetchProgress(TCustomADODataSet *DataSet,
          int Progress, int MaxProgress, TEventStatus &EventStatus);
        void __fastcall prvwbx1Click(TObject *Sender);
        void __fastcall Button9Click(TObject *Sender);
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
        void __fastcall Button10Click(TObject *Sender);
        void __fastcall Button11Click(TObject *Sender);
        void __fastcall mniN10Click(TObject *Sender);
        void __fastcall Button12Click(TObject *Sender);
        void __fastcall Button13Click(TObject *Sender);
        void __fastcall Button14Click(TObject *Sender);
        void __fastcall Button15Click(TObject *Sender);
        void __fastcall mniN11Click(TObject *Sender);


private:	// User declarations
        bool ReplaceStr(String *str, const String oldStr, const String newStr);
        void __fastcall  SaveToExcel(char *);
        void __fastcall TestData(int);
        bool ToHtml(TStringGrid *, char *, char *);
        bool ToHtml(TDBGrid *, char *, char *);
        int iStart,iEnd;
        void __fastcall  GetDBGridColumnsRange(TDBGrid *dbg, String FieldName, int &iStart, int &iEnd);

public:		// User declarations
        __fastcall TfrmMainGhost(TComponent* Owner);
        void __fastcall StringGrid1DrawCell(TObject *Sender, int ACol,
          int ARow, TRect &Rect, Grids::TGridDrawState  State);
               void __fastcall StringGrid2DrawCell(TObject *Sender, int ACol,
          int ARow, TRect &Rect, Grids::TGridDrawState  State);
                void __fastcall StringGrid3DrawCell(TObject *Sender, int ACol,
          int ARow, TRect &Rect, Grids::TGridDrawState  State);

};
//---------------------------------------------------------------------------
extern PACKAGE TfrmMainGhost *frmMainGhost;
//---------------------------------------------------------------------------
#endif
